class Maybe{
    constructor(value) {
        this.value = value
    }
    static of(value) {
        return new Maybe(value)
    }
    map = (fn)=> {
        return this.isNothing() ? Maybe.of(this.value) : Maybe.of(fn(this.value))
    }
    isNothing = ()=> { 
        return this.value === null || this.value === undefined
    }
}
class Container {
    constructor(value) {
        this.value = value
    }
    static of(value) {
        return new Container(value)
    }
    map = (fn)=> {
        return this.isNothing() ? Container.of(this.value) : Container.of(fn(this.value))
    }
    isNothing = ()=> { 
        return this.value === null || this.value === undefined
    }
}
module.exports = {
    Maybe,
    Container
}